package org.jeecg.modules.purchase.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.purchase.entity.PurchasePlan;

@Mapper
public interface PurchasePlanMapper extends BaseMapper<PurchasePlan> {

    @Select("SELECT COUNT(*) FROM proc_purchase_plan WHERE project_number = #{projectNumber}")
    int checkProjectNumberExists(@Param("projectNumber") String projectNumber);

    @Select("SELECT * FROM proc_purchase_plan WHERE audit_status = '1' AND id = #{id}")
    PurchasePlan getApprovedPlanById(@Param("id") String id);

    @Select("SELECT COUNT(*) FROM proc_purchase_plan WHERE id = #{id}")
    Integer CountById(@Param("id") String id);

}
